Skip to content

add tests to support issue 4476 #4519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

blizzz
Copy link

@blizzz blizzz commented Jun 20, 2025

This is:

  • a bugfix
  • a new feature
  • refactoring
  • additional unit tests

Checklist:

  • Changes are covered by unit tests
    • Changes are covered by existing unit tests
    • New unit tests have been added
  • Code style is respected
  • Commit message explains why the change is made (see https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
  • CHANGELOG.md contains a short summary of the change and a link to the pull request if applicable
  • Documentation is updated as necessary

Why this change is needed?

This test shall proof that a time is interpreted wrongly, at least with XLSX. Cf. #4479 (comment)

Screenshot_20250620_120113

$reader = new Ods();
$spreadsheet = $reader->load($filename);
$sheet = $spreadsheet->getActiveSheet();
$rawValue = $sheet->getCell('A1')->getValue();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add:

/** @var float|int */

before this statement to eliminate the Phpstan error.

@oleibman
Copy link
Collaborator

The test failure here is, as we already know, a consequence of floating point rounding. However, it can be coded to avoid a problem. You want the result to agree to minutes (and the same general discussion would apply if you wanted to agree to seconds). You can achieve that by doing the following before formatting the DateTime object:

Date::roundMicroseconds($dt);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants